import 'package:bboy_music_box_2023/bean/bean_music_query.dart';

class UploadMusicBean {
  UploadMusicBean({
    required this.cursor,
    required this.data,
    required this.err,
    required this.errMsg,
    required this.token,
  });

  late final int cursor;
  late final List<Music> data;
  late final int err;
  late final String errMsg;
  late final String token;

  static UploadMusicBean getEmptyBean() {
    return UploadMusicBean(
      cursor: 0,
      data: [],
      err: 0,
      errMsg: "",
      token: "",
    );
  }

  UploadMusicBean.fromJson(Map<String, dynamic> json) {
    cursor = json['cursor'];
    data = List.from(json['data']).map((e) => Music.fromJson(e)).toList();
    err = json['err'];
    errMsg = json['err_msg'];
    token = json['token'];
  }

  Map<String, dynamic> toJson() {
    final _data = <String, dynamic>{};
    _data['cursor'] = cursor;
    _data['data'] = data.map((e) => e.toJson()).toList();
    _data['err'] = err;
    _data['err_msg'] = errMsg;
    _data['token'] = token;
    return _data;
  }
}
